
import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

import java.io.*;
import java.awt.image.*; 
import javax.imageio.*; 
import javax.swing.border.*;


public class GameBoardPanel extends JPanel
{
	
	//private final int WIDTH = 695;
	//private final int HEIGHT = 695;
	
	private NorthPanel northPanel;
	private SouthPanel southPanel;
	private WestPanel westPanel;
	private EastPanel eastPanel;
	private CenterPanel centerPanel;
	
	//private RollDicePanel dice;
	
	enum Move {left, up, right, down}
	private ImageIcon pawn_dog, pawn_hat, pawn_boat, pawn_wbarrow;
	private ImageIcon gameboard;
	private Timer timer;
	private int x, y, moveX, moveY;
	private Move direction; // 1 - left, 2 - up, 3 - right, 4 - down

	private final int DELAY = 20, IMAGE_SIZE = 25;
	private final int WIDTH = 695;
	private final int HEIGHT = 695;


	private PawnPanel pp;
	
	public GameBoardPanel()
	{
		setLayout(new BorderLayout());
		setBackground(new Color(200,222,186));
		setPreferredSize(new Dimension(WIDTH, HEIGHT));
		//setOpaque(false);
/*
		pawn_hat = new ImageIcon("C:/sweng/logos/pawn_hat_small.jpg");
		pawn_dog = new ImageIcon("C:/sweng/logos/pawn_dog_small.jpg");
		pawn_boat = new ImageIcon("C:/sweng/logos/pawn_boat_small.jpg");
		pawn_wbarrow = new ImageIcon("C:/sweng/logos/pawn_wheelbarrow_small2.jpg");

		gameboard = new ImageIcon("C:/sweng/logos/gameboard3.jpg");
		timer = new Timer(DELAY, new ReboundListener());
		x = 640;
		y = 640;
		moveX = moveY = -1;
		direction = Move.left;
		
		timer.start();
*/		
//		pp = new PawnPanel();
//		add(pp);
		//JButton j = new JButton("middle");
		//add(j, BorderLayout.CENTER);
		centerPanel = new CenterPanel();
		add(centerPanel, BorderLayout.CENTER);
		
		northPanel = new NorthPanel();
		add(northPanel, BorderLayout.NORTH);
		southPanel = new SouthPanel();
		add(southPanel, BorderLayout.SOUTH);
		westPanel = new WestPanel();
		add(westPanel, BorderLayout.WEST);
		eastPanel = new EastPanel();
		add(eastPanel, BorderLayout.EAST);
	} // end GameBoardPanel constructor
	
	
	public void buildHouses(int num, String dir, String name)
	{
		if(dir == "north")
		{
			northPanel.buildHouses(num, name);
		}
		else if(dir == "south")
		{
			southPanel.buildHouses(num, name);
		}
		else if(dir == "east")
		{
			eastPanel.buildHouses(num, name);
		}
		else if(dir == "west")
		{
			westPanel.buildHouses(num, name);
		}
	}
	
	public void removeAllHouses(String dir, String name)
	{
		if(dir == "north")
		{
			northPanel.removeAllHouses(name);
		}
		else if(dir == "south")
		{
			southPanel.removeAllHouses(name);
		}
		else if(dir == "east")
		{
			eastPanel.removeAllHouses(name);
		}
		else if(dir == "west")
		{
			westPanel.removeAllHouses(name);
		}
	}
	
	public void buildHotel(String dir, String name)
	{
		if(dir == "north")
		{
			northPanel.buildHotel(name);
		}
		else if(dir == "south")
		{
			southPanel.buildHotel(name);
		}
		else if(dir == "east")
		{
			eastPanel.buildHotel(name);
		}
		else if(dir == "west")
		{
			westPanel.buildHotel(name);
		}
	}	
	
} // end class GameBoardPanel
